//Tracker.vn  
//CopyRight By Tracker Group
 using System;
 using System.Text;
using System.Data;

namespace tracker.Models.DTO
{
    public class ETrackLog
    {
        public ETrackLog()
        {
        }

        #region FIELD DEFINE
        public const string FIELD_TRACKID = "TrackID";
        public const string FIELD_RECIEVETIME = "RecieveTime";
        public const string FIELD_DEVICEKEY = "DeviceKey";
        public const string FIELD_HEADER = "Header";
        public const string FIELD_LENGTH = "Length";
        public const string FIELD_CMD = "CMD";
        public const string FIELD_CRC = "Crc";
        public const string FIELD_ENDPACKET = "EndPacket";
        public const string FIELD_GPS_TIME = "Gps_time";
        public const string FIELD_GPS_STATUS = "Gps_status";
        public const string FIELD_LATITUDE = "Latitude";
        public const string FIELD_LONGITUDE = "Longitude";
        public const string FIELD_SPEED = "Speed";
        public const string FIELD_HEADING = "Heading";
        public const string FIELD_MAGNETIC_VARIATION = "Magnetic_variation";
        public const string FIELD_DIRECTION = "Direction";
        public const string FIELD_CRC_GPRMC = "Crc_gprmc";
        public const string FIELD_HDOP = "Hdop";
        public const string FIELD_ALTITUDE = "Altitude";
        public const string FIELD_STATE = "State";
        public const string FIELD_AD = "AD";
        public const string FIELD_BASEID = "Baseid";
        public const string FIELD_CSQ = "Csq";
        public const string FIELD_JOURNEY = "Journey";
        public const string FIELD_PACKET = "Packet";
        public const string FIELD_ALARMCODE = "AlarmCode";
        public const string FIELD_ANGLE = "Angle";
        public const string FIELD_TEMPERATURE = "Temperature";
        public const string FIELD_HIGH = "High";
        public const string FIELD_PICTURE = "Picture";
        public const string FIELD_NOTE = "Note";
        public const string FIELD_RUNTIME = "RunTime";
        public const string FIELD_SATELLITES = "Satellites";
        public const string FIELD_GSM_SIGNAL = "Gsm_Signal";
        #endregion

        #region PROPERTIES DEFINE
        private long _TrackID;
        private DateTime _RecieveTime;
        private string _DeviceKey;
        private string _Location;
        private string _DeviceName;
        private string _Header;
        private string _Length;
        private string _CMD;
        private string _Crc;
        private string _EndPacket;
        private DateTime _Gps_time;
        private string _Gps_status;
        private string _Latitude;
        private string _Longitude;
        private string _Speed;
        private string _Heading;
        private string _Magnetic_variation;
        private string _Direction;
        private string _Crc_gprmc;
        private string _Hdop;
        private string _Altitude;
        private string _State;
        private string _AD;
        private string _Baseid;
        private string _Csq;
        private string _Journey;
        private string _Packet;
        private string _Angle;
        private string _Temperature;
        private string _High;
        private string _Picture;
        private string _Note;
        private string _pGPSTime;
        private string _AlarmCode;
        private string _pGPSRecieveTime;
        private string _DeviceKeySecurity;

        public string DeviceKeySecurity
        {
            set { _DeviceKeySecurity = value; }
            get { return _DeviceKeySecurity; }
        }
        public string AlarmCode
        {
            set { _AlarmCode = value; }
            get
            {
                return _AlarmCode;
            }
        }
        private string _Satellites;
        public string Satellites
        {
            set { _Satellites = value; }
            get
            {
                return _Satellites;
            }
        }
        private string _Gsm_Signal;
        public string Gsm_Signal
        {
            set { _Gsm_Signal = value; }
            get
            {
                return _Gsm_Signal;
            }
        }
        private string _RunTime;
        public string RunTime
        {
            set { _RunTime = value; }
            get
            {
                return _RunTime;
            }
        }

        public string pGPSTime
        {
            set { _pGPSTime = value; }
            get
            {
                return _pGPSTime;
            }
        }
        public string pGPSRecieveTime
        {
            set { _pGPSRecieveTime = value; }
            get
            {
                return _pGPSRecieveTime;
            }
        }

        public long TrackID
        {
            get { return _TrackID; }
            set { _TrackID = value; }
        }
        public DateTime RecieveTime
        {
            get { return _RecieveTime; }
            set { _RecieveTime = value; }
        }
        public string Location
        {
            get { return _Location; }
            set { _Location = value; }
        }
        public string DeviceKey
        {
            get { return _DeviceKey; }
            set { _DeviceKey = value; }
        }
        public string DeviceName
        {
            get { return _DeviceName; }
            set { _DeviceName = value; }
        }
        public string Header
        {
            get { return _Header; }
            set { _Header = value; }
        }
        public string Length
        {
            get { return _Length; }
            set { _Length = value; }
        }
        public string CMD
        {
            get { return _CMD; }
            set { _CMD = value; }
        }
        public string Crc
        {
            get { return _Crc; }
            set { _Crc = value; }
        }
        public string EndPacket
        {
            get { return _EndPacket; }
            set { _EndPacket = value; }
        }
        public DateTime Gps_time
        {
            get { return _Gps_time; }
            set { _Gps_time = value; }
        }
        public string Gps_status
        {
            get { return _Gps_status; }
            set { _Gps_status = value; }
        }
        public string Latitude
        {
            get { return _Latitude; }
            set { _Latitude = value; }
        }
        public string Longitude
        {
            get { return _Longitude; }
            set { _Longitude = value; }
        }
        public string Speed
        {
            get { return _Speed; }
            set { _Speed = value; }
        }
        public string Heading
        {
            get { return _Heading; }
            set { _Heading = value; }
        }
        public string Magnetic_variation
        {
            get { return _Magnetic_variation; }
            set { _Magnetic_variation = value; }
        }
        public string Direction
        {
            get { return _Direction; }
            set { _Direction = value; }
        }
        public string Crc_gprmc
        {
            get { return _Crc_gprmc; }
            set { _Crc_gprmc = value; }
        }
        public string Hdop
        {
            get { return _Hdop; }
            set { _Hdop = value; }
        }
        public string Altitude
        {
            get { return _Altitude; }
            set { _Altitude = value; }
        }
        public string State
        {
            get { return _State; }
            set { _State = value; }
        }
        public string AD
        {
            get { return _AD; }
            set { _AD = value; }
        }
        public string Baseid
        {
            get { return _Baseid; }
            set { _Baseid = value; }
        }
        public string Csq
        {
            get { return _Csq; }
            set { _Csq = value; }
        }
        public string Journey
        {
            get { return _Journey; }
            set { _Journey = value; }
        }
        public string Packet
        {
            get { return _Packet; }
            set { _Packet = value; }
        }
        public string Angle
        {
            get { return _Angle; }
            set { _Angle = value; }
        }
        public string Temperature
        {
            get { return _Temperature; }
            set { _Temperature = value; }
        }
        public string High
        {
            get { return _High; }
            set { _High = value; }
        }
        public string Picture
        {
            get { return _Picture; }
            set { _Picture = value; }
        }
        public string Note
        {
            get { return _Note; }
            set { _Note = value; }
        }
        #endregion

        public static ETrackLog create(DataRow row)
        {
            ETrackLog trackLog = new ETrackLog();
            if (row["TrackID"] != DBNull.Value)
                trackLog.TrackID = (long)row["TrackID"];
            if (row["RecieveTime"] != DBNull.Value)
                trackLog.RecieveTime = (DateTime)row["RecieveTime"];
            if (row["DeviceKey"] != DBNull.Value)
                trackLog.DeviceKey = (string)row["DeviceKey"];
            if (row["Header"] != DBNull.Value)
                trackLog.Header = (string)row["Header"];
            if (row["Length"] != DBNull.Value)
                trackLog.Length = (string)row["Length"];
            if (row["CMD"] != DBNull.Value)
                trackLog.CMD = (string)row["CMD"];
            if (row["Crc"] != DBNull.Value)
                trackLog.Crc = (string)row["Crc"];
            if (row["EndPacket"] != DBNull.Value)
                trackLog.EndPacket = (string)row["EndPacket"];
            if (row["Gps_time"] != DBNull.Value)
                trackLog.Gps_time = (DateTime)row["Gps_time"];
            if (row["Gps_status"] != DBNull.Value)
                trackLog.Gps_status = (string)row["Gps_status"];
            if (row["Latitude"] != DBNull.Value)
                trackLog.Latitude = (string)row["Latitude"];
            if (row["Longitude"] != DBNull.Value)
                trackLog.Longitude = (string)row["Longitude"];
            if (row["AlarmTypeID"] != DBNull.Value)
                trackLog.AlarmCode = row["AlarmTypeID"].ToString();
            if (row["Speed"] != DBNull.Value)
                trackLog.Speed = (string)row["Speed"];
            if (row["Heading"] != DBNull.Value)
                trackLog.Heading = (string)row["Heading"];
            if (row["Magnetic_variation"] != DBNull.Value)
                trackLog.Magnetic_variation = (string)row["Magnetic_variation"];
            if (row["Direction"] != DBNull.Value)
                trackLog.Direction = (string)row["Direction"];
            if (row["Crc_gprmc"] != DBNull.Value)
                trackLog.Crc_gprmc = (string)row["Crc_gprmc"];
            if (row["Hdop"] != DBNull.Value)
                trackLog.Hdop = (string)row["Hdop"];
            if (row["Altitude"] != DBNull.Value)
                trackLog.Altitude = (string)row["Altitude"];
            if (row["State"] != DBNull.Value)
                trackLog.State = (string)row["State"];
            if (row["AD"] != DBNull.Value)
                trackLog.AD = (string)row["AD"];
            if (row["Baseid"] != DBNull.Value)
                trackLog.Baseid = (string)row["Baseid"];
            if (row["Csq"] != DBNull.Value)
                trackLog.Csq = (string)row["Csq"];
            if (row["Journey"] != DBNull.Value)
                trackLog.Journey = (string)row["Journey"];
            //if (idr["Packet"] != DBNull.Value)
            //    OTrackLog.Packet = (string)idr["Packet"];
            if (row["Angle"] != DBNull.Value)
                trackLog.Angle = (string)row["Angle"];
            if (row["Temperature"] != DBNull.Value)
                trackLog.Temperature = (string)row["Temperature"];
            if (row["High"] != DBNull.Value)
                trackLog.High = (string)row["High"];
            if (row["Picture"] != DBNull.Value)
                trackLog.Picture = (string)row["Picture"];
            if (row["Note"] != DBNull.Value)
                trackLog.Note = (string)row["Note"];
            if (row["RunTime"] != DBNull.Value)
                trackLog.RunTime = (string)row["RunTime"];
            if (row["DeviceKeySecurity"] != DBNull.Value)
                trackLog.DeviceKeySecurity = (string)row["DeviceKeySecurity"];
            if (row["Gsm_Signal"] != DBNull.Value)
                trackLog.Gsm_Signal = (string)row["JouGsm_Signalrney"];
            if (row["Satellites"] != DBNull.Value)
                trackLog.Satellites = (string)row["Satellites"];

            return trackLog;
        }
    }

    public class ENTTrackerName
    {
        public string trackname { get; set; }
        public string username { get; set; }
        public string snid { get; set; }
    }
 }
